let fs = require('fs')

let readfilepromise = new Promise(function (resolve, reject) {
    fs.readFile(fn,'utf-8',/*回调函数*/function (err,data) {
        if (err){
            console.log('读取文件失败：',err)
            reject(err)
        }
        // console.log('异步读取文件数据：',data)
        resolve(data)
    })
})
readfilepromise.then(data =>{
    console.log('data:',data)
}).catch(err =>{
    console.log('err:',err)
})